package name.fowler.refactoring.simplestore;

import name.fowler.refactoring.simplestore.reporter.impl.CustomerReport;
import name.fowler.refactoring.simplestore.reporter.impl.CustomerReporter;
import name.fowler.refactoring.simplestore.reporter.impl.PlainTextFormatter;

class MainClass {
	 public static void main(String[] args) {
		//Create Price Calculators
		PriceCalculatorStore.getInstance().add(new RegularMoviePriceCalculator()); 
		PriceCalculatorStore.getInstance().add(new ChildrensMoviePriceCalculator());
		PriceCalculatorStore.getInstance().add(new NewReleasePriceCalculator());
		// Create movies
		Movie movCinderella = new Movie("Cinderella", Category.Childrens);
		Movie movStarWars = new Movie("Star Wars", Category.Regular);
		Movie movGladiator = new Movie("Gladiator", Category.NewRelease);

		// Create customers
		Customer custMickeyMouse = new Customer("Mickey Mouse");
		//Customer custDonaldDuck = new Customer("Donald Duck");
		//Customer custMinnieMouse = new Customer("Minnie Mouse");

		// Create rentals
		Rental rental1 = new Rental(movCinderella, 5);
		Rental rental2 = new Rental(movStarWars, 5);
		Rental rental3 = new Rental(movGladiator, 5);

		// Assign rentals to customers
		custMickeyMouse.addRental(rental1);
		custMickeyMouse.addRental(rental2);
		custMickeyMouse.addRental(rental3);

		// Generate invoice
		CustomerReporter custMickeyMouseReporter = new CustomerReporter(custMickeyMouse);
		CustomerReport custMickeyMouseReport = custMickeyMouseReporter.createReport();
		String statement = new PlainTextFormatter().formatReport(custMickeyMouseReport);
		// Print the statement
		System.out.println(statement);		
	}
}

